-
Notifications
You must be signed in to change notification settings - Fork 13
Updated Client so the constructor accepts an array of options #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
quinncomendant
wants to merge
14
commits into
ConnectCorp:master
Choose a base branch
from
quinncomendant:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…verride default options. This allows additional configuration of the HttpClient (e.g., to change 'base_url' to sandbox URL, 'debug', and 'timeout').
…Service->exec() to allow specifying http method (these services require POST requests).
…s for these services forgot to be added during previous commit.)
…Service->exec() to allow specifying http method (these services require POST requests).
…s for these services forgot to be added during previous commit.)
…too quickly. Nexmo will reject requests if they are submitted too quickly with a "429 Too Many Requests" error. The limit for the Developer API is 3 requests per second, and the SMS and Voice APIs limit at 30 requests per second (except US/Canada, it's 1 request per second). Details at https://help.nexmo.com/hc/en-us/articles/203993598 This commit includes changes to use a RateLimitSubscriber, which is a native hook for the Guzzle HTTP client. It times the previous request, and if it is faster than the minimum to stay below the rate limit, it will sleep long enough so the second request does not violate the rate limit. SMS and Voice requests are timed on a per-LVN basis so the delay will only occur when sending from the same LVN too quickly would trigger the limit, but sending from different LVNs will still be fast. Each service class is given a getRateLimit() method which returns the limit for that specific API endpoint.
…ich are outside the GSM default character set. Nexmo claims to be able to support the GSM 03.38 Basic Character Set <http://unicode.org/Public/MAPPINGS/ETSI/GSM0338.TXT> in text (not unicode) messages. Here, I've changed this method to test specifically for these. The old method fails because many of these characters are outside the normal ASCII range, and because the characters cannot be converted safely using ord() and str_split().
…relax the validation to avoid throwing exceptions during perfectly valid API responses. * In Account/Numbers.php we end validation if the count is zero, which can occur if the account has no numbers attached. Also, removed the validation for moHttpUrl because this value may not exist if a number has been added without one (in which case the account's default moHttpUrl will be used). * In Account/Pricing/Country.php the country parameter should always be uppercase (Nexmo will error if it is not). Also, some countries to not have a 'mt' price value set (e.g., BV) so we can't freak out if it is missing.
Conflicts: src/Service/Service.php
Contributor
|
Please check unit test failures |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updated Client so the constructor accepts an array of options which override default options. This allows additional configuration of the HttpClient (e.g., to change 'base_url' to sandbox URL, 'debug', and 'timeout').